package com.wormpex.data.root.dao.shard.strategy;


import com.wormpex.lang.util.DateFormatUtils;

/**
 * Created by xueping.you on 15-7-29.
 */
public class DefaultShardStrategy extends ShardStrategy{

    /**
     * @param tableName
     * @param param1
     * @return
     */
    @Override
    public String getTableName(String tableName , ShardParam param1) {
        StringBuilder builder = new StringBuilder(tableName);
        builder.append("_");
        builder.append(getAssShardParam(param1));
        return builder.toString();
    }

    public static String getAssShardParam(ShardParam param1){
        StringBuilder builder = new StringBuilder();
        builder.append(DateFormatUtils.formatyyyyMMdd(param1.getDivideDate()));
        return builder.toString();
    }

}
